<template>
  <!-- 卫浴配置 -->
  <div class="pc-bathroom">
    <search-form
      :search-config="searchConfig"
      :label-width="150"
      @clear="clearSearch"
      @search="handleSearch"
    />
    <c-permission-tabs v-model="activatedType" code="tab">
      <el-tab-pane label="全部" name="all" opt-code="all">
        <List :serach-filters="serachFilters" :active-type="activatedType" type="all" />
      </el-tab-pane>
      <el-tab-pane label="待配置" name="configuration" opt-code="configuration">
        <List :serach-filters="serachFilters" :active-type="activatedType" type="configuration" />
      </el-tab-pane>
    </c-permission-tabs>
  </div>
</template>

<script>
// import Search from '../components/search'
import List from './components/list'
export default {
  name: 'PCBathroom',
  components: {
    // Search,
    List
  },
  data() {
    return {
      activatedType: '',
      serachFilters: [],
      searchConfig: [
        {
          label: '任务来源',
          prop: 'source',
          type: 'select',
          config: {
            selectData: [
              { label: '图纸设计', value: 'PIC_DESIGN' },
              { label: '图纸变更', value: 'PIC_CHANGE' }
            ]
          }
        },
        { label: '门店建设项目号', prop: 'constCode', type: 'text', value: '', placeholder: '' },
        {
          label: '所属门店',
          prop: 'shopCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'post',
            remoteUrl: '/select-service/api/v1/shop/page',
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'name',
              value: 'code'
            },
            selectData: []
          },
          dialogConfig: {
            title: '所属门店',
            interfacePath: '/select-service/api/v1/shop/page',
            setting: [{ prop: 'code', title: '编码' }, { prop: 'name', title: '名称' }],
            pageFlag: true
          }
        },
        {
          label: '所属客户',
          prop: 'clientCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'post',
            remoteUrl: '/select-service/api/v1/customer/page',
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'name',
              value: 'code'
            },
            selectData: [],
            apiHeader: { 'permission-code': 'bathroom', 'Permission-App': 'slm' }
          },
          dialogConfig: {
            title: '所属客户',
            interfacePath: '/select-service/api/v1/customer/page',
            setting: [{ prop: 'code', title: '编码' }, { prop: 'name', title: '名称' }],
            pageFlag: true
          }
        },
        {
          label: '所属办事处',
          prop: 'officeCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'post',
            remoteUrl: '/select-service/api/v1/organization/page',
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'name',
              value: 'code'
            },
            selectData: []
          },
          dialogConfig: {
            title: '所属办事处',
            interfacePath: '/select-service/api/v1/organization/page',
            setting: [{ prop: 'code', title: '编码' }, { prop: 'name', title: '名称' }],
            filtersRaw: [{ 'id': 'isOffice', 'property': 'isOffice', 'value': '1', 'operator': '=' }],
            pageFlag: true
          }
        },
        {
          label: '产品配置人',
          prop: 'proConfiguratorCode',
          type: 'dialog',
          value: '',
          placeholder: '',
          config: {
            requestMethod: 'post',
            remoteUrl: `${process.env.VUE_APP_BASE_API}/api/v1/user/listUsers`,
            paramField: 'keyWord', // 远程搜索参数名
            defaultProps: {
              label: 'userName',
              value: 'account'
            },
            selectData: []
          },
          dialogConfig: {
            title: '产品配置人',
            interfacePath: `${process.env.VUE_APP_BASE_API}/api/v1/user/listUsers`,
            setting: [{ prop: 'account', title: '编码' }, { prop: 'userName', title: '名称' }],
            pageFlag: true
          }
        },
        {
          label: '产品配置进度',
          prop: 'schedule',
          type: 'select',
          config: {
            selectData: [
              { label: '待配置', value: 'A' },
              { label: '已完成', value: 'C' },
              { label: '已终止', value: 'D' }
            ]
          }
        }
      ]
    }
  },
  created() {
  },
  methods: {
    // 清空搜索条件
    clearSearch(data) {
      this.serachFilters = []
    },
    // 获取搜索条件
    handleSearch(data) {
      this.serachFilters = data.filtersRaw
    }
  }
}

</script>

<style lang="scss" scoped>
.pc-bathroom{

}
</style>
